package org.tity.test.java.webflux;

import org.springframework.context.annotation.Configuration;

@Configuration
public class CityRouter {

	
//	@Bean
//    public RouterFunction<ServerResponse> route() {
//        return RouterFunctions.route(
//        		RequestPredicates.GET("/wf"), (request) -> {
//        			
//        			return ServerResponse.ok().contentType(MediaType.TEXT_PLAIN)
//        	                .body(BodyInserters.fromObject("Hello, City!"));
//                    
//                });
//    }
//	
//	@Bean
//    public RouterFunction<ServerResponse> monoRouterFunction(CityHandler cityHandler) {
//        return RouterFunctions.route(GET("/echo"), cityHandler::helloCity);
//    }
	

//    @Bean
//    public RouterFunction<ServerResponse> routeCity(CityHandler cityHandler) {
//        return RouterFunctions
//                .route(RequestPredicates.GET("/webflux-hello")
//                                .and(RequestPredicates.accept(MediaType.TEXT_PLAIN)),
//                        cityHandler::helloCity);
//    }
//    
//    @Autowired
//	private Environment environment;
//
//	@Bean
//	public HttpServer httpServer(RouterFunction<?> routerFunction) {
//		HttpHandler httpHandler = RouterFunctions.toHttpHandler(routerFunction);
//		ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(httpHandler);
//		HttpServer server = HttpServer.create("localhost", Integer.valueOf(environment.getProperty("server.port")));
//		server.newHandler(adapter);
//		return server;
//	}

}
